package com.mms.dao;

import java.util.Date;

import org.junit.Test;

import com.mms.entity.Customer;
import com.mms.entity.CustomerState;
import com.mms.entity.Gender;
import com.mms.entity.InfoSource;
import com.mms.util.MyBatisUtilsPlus;

public class CustomerMapperTest {

	CustomerMapper mapper = MyBatisUtilsPlus.getMapper(CustomerMapper.class);
	
	@Test
	public void testInsert() {
		Customer c = new Customer();
		c.setName("batistuta");
		c.setGender(Gender.MALE);
		c.setPhone("333");
		c.setState(CustomerState.INTENTIONAL);
		c.setSource(InfoSource.MEDIA);
		c.setReportToDate(new Date());
		this.mapper.insert(c);
		System.out.println("插入成功，数据库自动生成的id值为：" + c.getCustId());
	}

	@Test
	public void testCountByNameOrPhoneLikeAndStateAndOwnerUsername() {
		long total = this.mapper.countByNameOrPhoneLikeAndStateAndOwnerUsername("", CustomerState.INTENTIONAL, "becky");
		System.out.println(total);
	}

	@Test
	public void testSelectByNameOrPhoneLikeAndStateAndOwnerUsernamePageable() {
		this.mapper.selectByNameOrPhoneLikeAndStateAndOwnerUsernamePageable("", CustomerState.INTENTIONAL, "", 40, 10);
	}

}
